<template>
<div>
 <el-descriptions title='用户信息'  :column="2" size='40' border>
  <el-descriptions-item label="用户名" class="el-icon-s-custom">
    {{user.username}}
    </el-descriptions-item>
  <el-descriptions-item label="工号">
   {{user.workId}}
  </el-descriptions-item>
 <el-descriptions-item label="年龄">
       {{user.age}} 
 </el-descriptions-item>
  <el-descriptions-item label="性别">
       {{user.sex | changesex}} 
 </el-descriptions-item>
  <el-descriptions-item label="地址">
       {{user.address}} 
 </el-descriptions-item>
  <el-descriptions-item label="电话">
       {{user.phone}} 
 </el-descriptions-item>
  <el-descriptions-item label="邮箱">
       {{user.email}} 
 </el-descriptions-item>
  <el-descriptions-item label="密码">
       {{user.password}} 
 </el-descriptions-item>
  <el-descriptions-item label="部门">
       {{user.departmentName}} 
 </el-descriptions-item>
    <el-descriptions-item label="岗位">
       {{user.postName}} 
 </el-descriptions-item>
</el-descriptions>
</div>

</template>

<script>

export default {
  name: 'HomeView',
  data() {
    return {
      user: JSON.parse(localStorage.getItem("user"))
    }
  },
  methods: {
    logout() {
      this.$router.push("/")
      localStorage.removeItem("user")
      this.$message.success("退出成功")
    }
  },
  filters:{
    changesex(data){
      if(data ==1){
        return '男'
      }else if(data ==2){
        return '女'
      }
    }
  }
}
</script>
